using Mvc.Mailer;
using HomeStayWebCP.Models.BusinessObject;

namespace HomeStayWebCP.Mailers
{
    public class MyMailer : MailerBase
    {
        public MyMailer()
        {
            MasterName = "_Layout";
        }

        public virtual MvcMailMessage Welcome(MailObject obj)
        {
            //ViewBag.Data = someObject;
            ViewBag.Sender = obj.Sender;
            ViewBag.SenderPhone = obj.SenderPhone;
            ViewBag.SenderEmail = obj.SenderEmail;
            ViewBag.Content = obj.Content;
            ViewBag.PostTitle = obj.PostTitle;

            return Populate(x =>
                                {
                                    x.Subject = "You have a message from HomeStayWeb";
                                    x.ViewName = "Welcome";
                                    x.To.Add(obj.ContactEmail);
                                });
        }

        public virtual MvcMailMessage MailAcceptPost(string title, string contactmail)
        {
            ViewBag.PostTile = title;
            return Populate(x =>
                                {
                                    x.Subject = "You have a message from HomeStayWeb";
                                    x.ViewName = "MailAcceptPost";
                                    x.To.Add(contactmail);
                                });
        }

        public virtual MvcMailMessage MailRejectPost(string title, string contactmail, string reason)
        {
            ViewBag.PostTile = title;
            ViewBag.ReasonReject = reason;
            return Populate(x =>
                                {
                                    x.Subject = "You have a message from HomeStayWeb";
                                    x.ViewName = "MailRejectPost";
                                    x.To.Add(contactmail);
                                });
        }

        public virtual MvcMailMessage MailBanUser(string username, string reason, string contactmail)
        {
            ViewBag.Username = username;
            ViewBag.Reason = reason;
            return Populate(x =>
                                {
                                    x.Subject = "You have a message from HomeStayWeb";
                                    x.ViewName = "MailBanUser";
                                    x.To.Add(contactmail);
                                });
        }

        public virtual MvcMailMessage MailForgotPass(string username, string password, string email)
        {
            ViewBag.Username = username;
            ViewBag.Password = password;
            return Populate(x =>
            {
                x.Subject = "You have a message from HomeStayWeb";
                x.ViewName = "MailForgotPassword";
                x.To.Add(email);
            });
        }
    }
}